package com.redrose.videodemo.base;

import android.content.Context;

import com.redrose.videodemo.utils.CrashHandler;
import com.redrose.videodemo.utils.GlideUtils;
import com.redrose.videodemo.utils.SPUtils;
import com.redrose.videodemo.utils.ThreadTask;

import org.litepal.LitePalApplication;
import org.xutils.x;

/**
 * Desc: application
 * author: RedRose
 * Date: 2019/3/30
 * Email: yinsxi@163.com
 */
public class ViewApplication extends LitePalApplication {
    private static ViewApplication mContext;

    @Override
    public void onCreate() {
        super.onCreate();
        mContext = this;
        x.Ext.init(this);
        //设定是否输出日志，开启会影响性能
        x.Ext.setDebug(true);
        SPUtils.init(this);
        GlideUtils.init(this);
        ThreadTask.getInstance().executorOtherThread(new Runnable() {
            @Override
            public void run() {
                CrashHandler.getIntance().init(mContext);
            }
        }, ThreadTask.ThreadPeriod.PERIOD_HIGHT);
    }

    public static ViewApplication getAppContext() {
        return mContext;
    }
}
